20. Edge Case: Dependency Injection Disadvantages

Edge Case: Dependency Injection Disadvantages

ND079 JPND C2 L03 A20 Edge Case Dependency Injection

Some Disadvantages

  • Requires extra configuration (annotations or XML).
  • Can make code harder to understand and debug.

What are some good reasons to use dependency injection?

SOLUTION:
  • DI helps you adhere to the Liskov Substitution Principle
  • DI helps you adhere to the Interface Segregation Principle
  • DI helps you adhere to the Dependency Inversion Principle
  • DI improves code testability.